package com.itc.bi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itc.bi.dto.DataSetListDto;
import com.itc.bi.entity.DirectDataSetEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author hecai
* @description 针对表【tb_direct_data_set(数据集表)】的数据库操作Mapper
* @createDate 2024-06-14 17:25:39
* @Entity com.itc.bi.DirectDataSet
*/
public interface DirectDataSetMapper extends BaseMapper<DirectDataSetEntity> {

    @Select("select table_name from tb_direct_data_set where is_deleted = 0 and type ='DB' and ds_id = ${dsId} and dt_id = ${dtId}")
    List<String> getTableNameByDsIdAndDtId(@Param("dsId") Long dsId,@Param("dtId") Long dtId);

    @Select("select count(*) from tb_direct_data_set where ds_id = ${dsId} and is_deleted = 0")
    int getCountByDsId(@Param("dsId") Long dsId);

    @Select("select dt_id as id,name from tb_directory where is_deleted = 0 and is_dir = 1")
    List<DataSetListDto> dataSetList();

}




